<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<jsp:include page="../../fragments/header.jsp">
	<jsp:param name="title" value="Shopping Cart" />
</jsp:include>

<c:choose>
	<c:when test="${empty shoppingCartList}">
		<p>There are no items in shopping cart</p>
	</c:when>
	<c:otherwise>

		<ol class="progtrckr">
			<li class="progtrckr-todo">Shopping Cart</li>
			<li class="progtrckr-todo">Customer Info</li>
			<li class="progtrckr-todo">Payment Options</li>
			<li class="progtrckr-todo">Finalizing Order</li>
		</ol>
		<br />
		<br />

		<p>List of shopping cart items</p>

		<c:forEach items="${shoppingCartList}" var="product">

			<div class="product_details_box">

				<div class="form-horizontal">
					<div class="form-group">
						<label class="label"><b>Book</b></label>
						<label class="data">${product.key.name}, ${product.key.author}</label>
					</div>
					<div class="form-group">
						<label class="label"><b>Price</b></label>
						<label class="data">${product.key.price} $</label>
					</div>
					<div class="form-group">
						<label class="label"><b>Quantity</b></label>
						<form class="data" action="change_quantity?id=${product.key.id}" method="POST">
							<input type="text" style="width: 50px;" name="quantity" value="${product.value}" />
							<input type="submit" class="more" value="Change Quantity" />
						</form>
					</div>

					<form action="shopping_cart_remove?id=${product.key.id}" method="POST">
						<input type="submit" class="btn btn-default btn-block" value="Remove From Shopping Cart" />
					</form>

					<hr />

				</div>
			</div>
		</c:forEach>

		<form action="${pageContext.request.contextPath}/product_list_back">
			<button class="btn btn-default">
				<b>Back to Books List</b>
			</button>
		</form>
		<form action="${pageContext.request.contextPath}/cancel_order">
			<button class="btn btn-default">
				<b>Cancel Order</b>
			</button>
		</form>
		<form action="${pageContext.request.contextPath}/customer_info">
			<button class="btn btn-default">
				<b>Next</b>
			</button>
		</form>

	</c:otherwise>
</c:choose>

<jsp:include page="../../fragments/footer.jsp" />